/**
 * Copyright (C) 2011 GreenSoft S.A.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *        http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ar.com.greensoft.neosystem.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Past;
import javax.validation.constraints.Size;

import ar.com.greensoft.neosystem.model.constraint.PersonaJuridicaContraints;
import ar.com.greensoft.neosystem.model.references.RazonSocial;

/**
 * Simple JavaBean domain object that represents a Legal Person in the
 * Customer Relationship Management System.  
 *  
 * @author Jorge E. Villaverde
 * @since 04/01/2012
 * @version 1.0.0
 */
@Entity
@Table(name="persona_juridica")
@NamedQueries({
	@NamedQuery(name=PersonaJuridica.FIND_BY_CUIT_QUERY_NAME, 
		query="SELECT c FROM PersonaJuridica c WHERE c.cuit = :cuit"),
	@NamedQuery(name=PersonaJuridica.FIND_BY_TIPO_NRO_DOC_QUERY_NAME, 
		query="SELECT c FROM PersonaJuridica c WHERE c.tipoDocumento = :tipoDocumento AND c.numeroDocumento = :numeroDocumento"),
	@NamedQuery(name=PersonaJuridica.FIND_BY_NAME_QUERY_NAME, 
		query="SELECT c FROM PersonaJuridica c WHERE c.nombre = :name"),
})
@PersonaJuridicaContraints
public class PersonaJuridica extends Persona { 
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static final String FIND_ALL_QUERY_NAME = "PersonaJuridica.findAll";
	public static final String FIND_BY_CUIT_QUERY_NAME = "PersonaJuridica.findByCuit";
	public static final String FIND_BY_TIPO_NRO_DOC_QUERY_NAME = "PersonaJuridica.findByTipoNumeroDocumento";
	public static final String FIND_BY_NAME_QUERY_NAME = "PersonaJuridica.findByName";
	public static final String COUNT_QUERY_NAME = "PersonaJuridica.count";
	
	@NotNull
	@Size(min=1, max=70)
	private String nombre;
		
	@Enumerated(EnumType.STRING)
	private RazonSocial razonSocial;

	@Temporal(TemporalType.TIMESTAMP)
    @Column(name = "fecha_contrato_social")
	@Past
	private Date fechaContratoSocial;
	
	public String getNombre() {
		return nombre;
	}

	public void setNombre(String nombre) {
		this.nombre = nombre;
	}

	public RazonSocial getRazonSocial() {
		return razonSocial;
	}

	public void setRazonSocial(RazonSocial razonSocial) {
		this.razonSocial = razonSocial;
	}

	public Date getFechaContratoSocial() {
		return fechaContratoSocial;
	}

	public void setFechaContratoSocial(Date fechaContratoSocial) {
		this.fechaContratoSocial = fechaContratoSocial;
	}
	
}
